-
Notifications
You must be signed in to change notification settings - Fork 30
feat: add --existing-policy flag in verify-policy command for predefined policies #1189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
30b51e3 to
ce3dfd5
Compare
behnazh-w
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a unit test to tests/policy_engine/test_policy.py. Also add an integration test.
ae722e9 to
a2203de
Compare
40dbe23 to
ff9fff7
Compare
src/macaron/resources/policies/datalog/malware-detection-dependencies.dl.template
Outdated
Show resolved
Hide resolved
behnazh-w
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we add a --list-policies option to verify-policy, allowing users to easily see and choose from the available policies. We should also update the tutorial to include this new option. Additionally, we can provide a description file for each template policy and display that information when the command is used. To ensure consistency, let’s add a unit test that verifies every template policy has an associated description file.
src/macaron/resources/policies/datalog/check-github-actions.dl.template
Outdated
Show resolved
Hide resolved
src/macaron/resources/policies/datalog/malware-detection-dependencies.dl.template
Outdated
Show resolved
Hide resolved
src/macaron/resources/policies/datalog/malware-detection.dl.template
Outdated
Show resolved
Hide resolved
src/macaron/resources/policies/datalog/check-github-actions.dl.template
Outdated
Show resolved
Hide resolved
5381e89 to
8ab86ef
Compare
Signed-off-by: Demolus13 <[email protected]>
Signed-off-by: Demolus13 <[email protected]>
Signed-off-by: Demolus13 <[email protected]>
Signed-off-by: Demolus13 <[email protected]>
…olicy command Signed-off-by: Demolus13 <[email protected]>
Signed-off-by: Demolus13 <[email protected]>
Signed-off-by: Demolus13 <[email protected]>
Signed-off-by: Demolus13 <[email protected]>
Signed-off-by: Demolus13 <[email protected]>
… the .description file Signed-off-by: Demolus13 <[email protected]>
Signed-off-by: Demolus13 <[email protected]>
Signed-off-by: Demolus13 <[email protected]>
Signed-off-by: Demolus13 <[email protected]>
Signed-off-by: Demolus13 <[email protected]>
Signed-off-by: Demolus13 <[email protected]>
6fe2a5b to
2bf5a58
Compare
Summary
This Pull Request introduces a new
--existing-policyflag to theverify-policycommand, allowing users to run example policies by name without specifying a file path. It also adds support for policy templates.The new
--existing-policy(-e) flag executes a predefined policy template by name. If the template exists, it populates the<PACKAGE_PURL>placeholder with the value from the--package-url(-purl) argument and runs the policy. If the template name is not found, it lists all available templates.Example policies
Description of changes
--existing-policy(-e) argument to theverify-policyCLI command, enabling users to select and run example policies from the built-in resources.resources/policies/datalogdirectory.--package-url(-purl) argument to substitute the<PACKAGE_PURL>placeholder in policy templates.--existing-policy(-e) flag intests/policy_engine/test_existing_policy.pyRelated issues
N/A
Checklist
verifiedlabel should appear next to all of your commits on GitHub.